using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Security.Cryptography;
using Blog.Util;
//用户密码加密hash值
using Microsoft.AspNetCore.Cryptography.KeyDerivation;

namespace Blog.Models
{
    public class Account
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ID { get; set; }
        private string _passWord = "";
        public string UserName { get; set; }
        public string PassWord
        {
            get
            {
                return _passWord;

            }
            set
            {
               _passWord=SecurityHelper.Encrypt(value);

            }
        }
        ///<summary>
        ///头像地址（预留）
        ///</summary>
        public string HeadPortraitsUrl { get; set; }
        ///<summary>
        ///
        ///</summary>
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime CreateTime { get; set; }
        ///<summary>
        ///
        ///</summary>
        public DateTime UpdateTime { get; set; }
    }
}